#include <iostream>
#include <fstream>
using namespace std;
#include "Pyramid.h"
#include "RobotLogic.h"
#include "Robot.h"

void main(int argc, char* argv[])
{
	Robot robot;
	robot.loadMap("input.txt");
	robot.loadKB("kb.txt");
	robot.setStartPoint(0,0);
	char m[10];
	int result;
	do
	{
		result = robot.update();
		cout<<'.';


	}while(result==-1);
	ofstream output("0912125_0912172.txt");
	if(result == 2)
	{
		cout<<endl<<robot.getCost()<<endl;
		output<<robot.getCost()<<endl;
		vector<string> listAction = robot.getListAction();
		for(int i=0;i<listAction.size();i++)
		{
			cout<<listAction[i]<<" ";
			if(i>0)
				output<<", ";
			output<<listAction[i];
		}
	}
	else if(result == 1)
	{
		//null
		cout<<"null";
		output<<"NULL";
	}
	else if(result == 0)
	{
		//can't resolve
		cout<<"can\'t resolve";
		output<<"CANT\'T RESOLVE";
	}		
	output.close();
}